package com.victualler.core.config.permission.controller.impl;

import com.victualler.core.base.controller.impl.BaseRestControllerImpl;

import com.victualler.core.common.dto.PageDto;
import com.victualler.core.config.permission.controller.UserInfoController;
import com.victualler.core.config.permission.dto.request.UserRequestDto;
import com.victualler.core.config.permission.entity.UserInfoDao;
import com.victualler.core.config.permission.repository.UserInfoQueryRepository;
import com.victualler.core.config.permission.repository.UserInfoRepository;
import com.victualler.core.config.permission.service.UserInfoService;

import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: Guoshichang
 * @discription:    
 */
@RestController
@RequestMapping("/core/config/permission/user")
public class UserInfoControllerImpl extends BaseRestControllerImpl<UserInfoDao,UserInfoRepository,UserInfoQueryRepository,UserInfoService> implements UserInfoController {
    /**
     * @author Guoshichang
     * @since 19:04 on 2018/7/5.
     * @param userId 用户id
     * @Function  获取用户id
     */
    @RequestMapping("/get/{userId}")
    @Override
    public UserInfoDao getByUserId(@PathVariable("userId") String userId) {
        return this.baseService.getByUserId(userId);
    }

    /**
     * @author Guoshichang
     * @since 13:39 on 2018/7/7.
     * @param userRequestDto
     * @Function  根据条件入参PermissionRequestDto动态分页查询权限
     */
    @RequestMapping("getByRequestDto")
    @Override
    public PageDto<UserInfoDao> getByRequestDto(@RequestBody UserRequestDto userRequestDto, @RequestParam("pageNo") int pageNo, @RequestParam("limit")  int limit) {
        return this.baseService.getByRequestDto(userRequestDto,pageNo,limit);
    }
}
